<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>

<c:if test="${userID==null}">
  <c:redirect url="index-msa.jsp" />
</c:if>

<c:if test="${userID==null}">
  <c:redirect url="index-msa.jsp" />
</c:if>

<html>
  <head>
    <title>Welcome 
    <c:out value="${userID}" />
    </title>
  </head>

  <body link="#000000" vlink="#000000" alink="#000000">
  <sql:query var="forums" dataSource="${dataSource}">
  select c_code,c_name from t_forums order by c_sequence
  </sql:query>

  <p>Select one of the following forums. Each form contains
  messages on the given topic.</p>

  <table border="0" width="378">
    <tr>
      <td colspan="2" bgcolor="#0000FF" width="372">
      <b>
        <font size="4" color="#FFFFFF">Please select a forum</font>
      </b>

      .</td>
    </tr>

    <c:forEach var="row" items="${forums.rows}" varStatus="status">
      <jsp:useBean id="status"
      type="javax.servlet.jsp.jstl.core.LoopTagStatus" />

      <c:choose>
        <c:when test="<%=status.getCount()%2==0%>">
          <c:set var="color" value="#FFFFFF" />
        </c:when>

        <c:otherwise>
          <c:set var="color" value="#FFFF66" />
        </c:otherwise>
      </c:choose>

      <tr bgcolor="<c:out value="${color}"/>">
      <td width="106">
        <c:url value="forum.jsp" var="sel">
          <c:param name="id" value="${row.c_code}" />
        </c:url>

        <a href="<c:out value="${sel}"/>">
        <c:out value="${row.c_code}" />
        </a>
      </td>

      <td width="262">
        <c:out value="${row.c_name}" />
      </td>
      </tr>
    </c:forEach>
  </table>

  &#160;
  <p>
    <c:if test="${userType=='A'}">
      <a href="admin.jsp">[Admin]</a>
    </c:if>
  </p>
  </body>
</html>

